<template>
	<view class="pageBg">
		<swiperBox :data="data"></swiperBox>
		<briefIntroduction :data="data" :price="price" :type="type" @FavoriteEdit="init"></briefIntroduction>
		<purchaseTickets :data="data" @editPrice="editPrice"></purchaseTickets>
		<surface :data="data" :type="type"></surface>
		<optview :oid="oid" :ticket="ticket" class="optview" :GoodsItem="GoodsItem" :data="data"></optview>
	</view>
</template>
<script>
	import swiperBox from '@/components/wbz/swiperBox/swiperBox.vue';
	import briefIntroduction from '@/components/wbz/briefIntroduction/briefIntroduction.vue';
	import purchaseTickets from '@/components/wbz/purchaseTickets/purchaseTickets.vue';
	import surface from '@/components/wbz/surface/surface.vue';
	import optview from '@/components/wbz/optview/optview.vue';
	export default {
		components: {
			swiperBox,
			briefIntroduction,
			purchaseTickets,
			optview,
			surface,
		},
		data() {
			return {
				id: '',
				data: {},
				price: '0.00',
				type: '2',
				GoodsItem: '',
				ticket: false,
			};
		},
		onLoad({ id, type, ticket, oid }) {
			this.id = id;
			this.type = type + '';
			this.ticket = ticket ? true : false;
			this.oid = oid;
			this.init();
		},
		methods: {
			async init() {
				const { data } = await this.$api.goodsgetGoodsDetail({ goods_id: this.id });
				this.data = data;
			},
			editPrice({ price, GoodsItem }) {
				this.price = price;
				this.GoodsItem = GoodsItem;
			},
		},
	};
</script>

<style lang="scss" scoped>
	.pageBg {
		position: relative;
	}
</style>
